 <!doctype html>
 <html lang="zh-CN">
 <head>
   <meta charset="UTF-8">
     <link rel="stylesheet" href="css/common.css"/>
     <link rel="stylesheet" href="css/main.css"/>
     <link rel="stylesheet" href="css/jquery-ui-timepicker-addon.css"/>
     <link rel="stylesheet" href="css/jquery-ui.css"/>
     <link href="css/bootstrap.css" rel="stylesheet" type="text/css" />
     <link href="css/city-picker.css" rel="stylesheet" type="text/css" />
     <link rel="stylesheet" href="css/jquery-impromptu.min.css" type="text/css"/>
     <link rel="stylesheet" href="css/iconfont.css" type="text/css"/>
   <title>出差报销单</title>
 </head>
 <body>
 <div id="dataLoad" style="display:none; position: fixed; width: 100%; top: 20%; z-index: 1001;">
        <table width=100% height=100% border=0 align=center valign=middle>
         <tr height=50%><td align=center>&nbsp;</td></tr>
         <tr><td align=center><img src="images/loading.gif"/></td></tr>
         <tr><td align=center>提交中，请稍后......</td></tr>
         <tr height=50%><td align=center>&nbsp;</td></tr>
        </table>
      </div>
  <div class="container">
    <div id="search_bar" class="mt10">
       <div class="box">
          <div class="box_border">
            <div class="box_top"><b class="pl15">基本报销信息</b></div>
            <div class="box_center pt10 pb10" style="margin-left: 10%">
              <table class="form_table" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td>报销人姓名</td>
                  <td><input type="text" name="name" class="input-text lh25" size="20" disabled id="apply_name"></td>
                  <td>所属部门</td>
                  <td><input type="text" name="name" class="input-text lh25" size="20" disabled id="apply_section_name"></td>
                    <td>职别</td>
                    <td><input type="text" name="name" class="input-text lh25" size="10" disabled id="execu_level"></td>
                  <td>性别</td>
                  <td>
                    <span class="fl">
                      <div class="select_border"> 
                        <div class="select_containers "> 
                        <select name="" class="select" id="apply_sex" disabled>
                            <option value="0">男</option>
                            <option value="1">女</option>
                        </select> 
                        </div> 
                      </div> 
                    </span>
                  </td>

                </tr>
                  <tr>
                      <td>出差类别</td>
                      <td><input type="text" name="name" class="input-text lh25" size="20" disabled id="business_type"></td>
                      <td>大案要案号</td>
                      <td><input type="text" name="name" class="input-text lh25" size="20" disabled id="case_no"></td>
                      <td>预批天数</td>
                      <td><input type="text" name="name" class="input-text lh25" size="10" disabled id="pre_apply_days"></td>
                      <td>预批出差地</td>
                      <td><input type="text" name="name" class="input-text lh25" size="30" disabled id="pre_destination"></td>
                  </tr>
                <tr>
                  <td>公务卡号</td>
                  <td><input type="text" name="name" class="input-text lh25" size="20" disabled id="apply_card_num" value="6227 0036 6000 0046 690"></td>
                  <td>身份证号</td>
                  <td><input type="text" name="name" class="input-text lh25" size="20" disabled id="apply_salary_num"></td>
                    <td>预借差旅</td>
                    <td><input type="text" name="name" class="input-text lh25" size="10" disabled id="pre_loan_money"></td>
                    <td>自驾车</td>
                    <td>
                    <span class="fl">
                      <div class="select_border">
                          <div class="select_containers ">
                              <select name="" class="select" id="self_drive" disabled>
                                  <option value="0">否</option>
                                  <option value="1">是</option>
                              </select>
                          </div>
                      </div>
                    </span>
                    </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
    </div>
     <div id="forms" class="mt10">
        <div class="box">
          <div class="box_border">
            <div class="box_top"><b class="pl15">填写报销信息</b></div>
            <div class="box_center">
              <form action="" class="jqtransform">
               <table class="form_table pt15 pb15" width="100%" border="0" cellpadding="0" cellspacing="0">
                   <tr>
                       <td class="td_right">开始时间：</td>
                       <td class="">
                           <input type="text" placeholder="点击选择开始时间" name="business_start_time" class="input-text lh25" id="business_start_time" size="20">
                       </td>
                   </tr>
                   <tr>
                       <td class="td_right">出发地：</td>
                       <td>
                           <div>
                               <div class="form-group" style="width:500px; float: left">
                                   <div style="position: relative;">
                                       <input id="start_addr" class="form-control" readonly type="text" >
                                   </div>
                               </div>
                           </div>
                       </td>
                       <td>
                            <span class="fl">
                              <div class="select_border">
                                  <div class="select_containers">
                                      <td class="td_right">具体县/乡：</td>
                                      <td class="">
                                          <input type="text" placeholder="请输入具体县/乡" name="start_addr_county" class="input-text lh25" size="20" id="start_addr_county"/>
                                      </td>
                                  </div>
                              </div>
                            </span>
                       </td>
                   </tr>  <!--出发地 -->

                   <tr>
                       <td class="td_right">结束时间：</td>
                       <td class="">
                           <input type="text" placeholder="点击选择结束时间" name="business_end_time" class="input-text lh25" id="business_end_time" size="20">
                       </td>
                   </tr>
                   <tr> <!--目的地-->
                       <td class="td_right" style="">目的地：</td>
                       <td>
                           <div id="distpicker" >
                               <div class="form-group" style="width:500px; float: left">
                                   <div style="position: relative;">
                                       <input id="end_addr" class="form-control" readonly type="text">
                                   </div>
                               </div>
                           </div>
                       </td>
                       <td>
                            <span class="fl">
                              <div class="select_border">
                                  <div class="select_containers ">
                                      <td class="td_right">具体县/乡：</td>
                                      <td class="">
                                          <input type="text" placeholder="请输入具体县/乡" name="end_addr_county" class="input-text lh25" size="20" id="end_addr_county">
                                      </td>
                                  </div>
                              </div>
                            </span>
                       </td>
                   </tr>
                   <tr>
                       <td class="td_right">路上天数</td>
                       <td class="">
                           <input type="number" placeholder="自动计算路上天数" name="road_days"  class="input-text lh25" id="road_days" size="30" disabled>
                           <span style="padding-left:20px">停留天数：</span>
                           <input type="number" placeholder="请输入停留天数，勿超过总天数" name="stay_days" class="input-text lh25" id="stay_days" size="30">
                       </td>
                       <td class="td_right  is_te_meeting">培训/会议期：</td>
                       <td class="is_te_meeting">
                           <input type="radio" name="is_te_meeting" value="1"> 是
                           <input type="radio" name="is_te_meeting" value="0" checked> 否
                       </td>
                   </tr>
                   <tr>
                       <td class="td_right">总天数：</td>
                       <td class="td_left" colspan="4">
                           <input type="number" placeholder="自动计算总天数" name="total_days" class="input-text lh25" id="total_days" size="30" disabled>
                           <span style="padding-left: 50%">
                               <button class="btn btn-warning " id="modify_addr" disabled type="button">修改出差地信息</button>
                               <button class="btn btn-danger" id="confirm_addr" type="button">确认出差地信息</button>
                           </span>
                       </td>
                   </tr>
                   <tr style="border-top:1px solid #d3dbde;"></tr>
                   <tr style="display:none" class="fee non_drive_self">
                       <td class="td_right">交通费用：</td>
                       <td height="40px" style="line-height:40px" colspan="3">
                           <span>车费</span>
                           <input type="number" placeholder="请输入车费,无请填0" name="car_fee" value="0" class="input-text lh25" id="car_fee" size="20">
                           <span style="padding-left:20px">船费</span>
                           <input type="number" placeholder="请输入船费,无请填0" name="boat_fee" value="0" class="input-text lh25" id="boat_fee" size="20">
                           <span style="padding-left:20px">机票</span>
                           <input type="number" placeholder="请输入机票费,无请填0" name="flight_fee" value="0" class="input-text lh25" id="flight_fee" size="20">
                       </td>
                   </tr>
                   <tr style="display:none" class="fee drive_self">
                       <td class="td_right">交通费用：</td>
                       <td height="40px" style="line-height:40px" colspan="4">
                           <span>过路费</span>
                           <input type="number" placeholder="请输入过路费" name="pass_fee" class="input-text lh25" id="pass_fee" size="20">
                           <span>里程</span>
                           <input type="number" placeholder="请输入总里程数" name="road_dist" class="input-text lh25" id="road_dist" size="20">
                           <span style="padding-left:20px">油费</span>
                           <input type="number" placeholder="自动计算油费" name="oil_fee" class="input-text lh25" id="oil_fee" size="20" disabled>
                           <span class="standard"></span>
                       </td>
                   </tr>
                   <tr class="fee" style="display:none">
                       <td class="td_right">基本报销：</td>
                       <td>
                           <span style="padding-left:1.5rem">住宿费</span>
                           <input type="number" placeholder="请输入住宿费" name="hotel_fee"  class="input-text lh25" id="hotel_fee" size="20">
                           <span></span>
                           <span class="standard">选择目的地，输入天数后,获取报销/补贴标准</span>
                       </td>
                   </tr>
                   <tr class="fee" style="display:none">
                       <td class="td_right"></td>
                       <td>
                           <span style="padding-left: 1.5rem">公杂费</span>
                           <input type="number" placeholder="自动计算，可修改" name="inci_fee"  class="input-text lh25" id="inci_fee" size="20">
                           <span></span>
                           <span class="standard">选择目的地，输入天数后,获取报销/补贴标准</span>
                       </td>
                   </tr>
                   <tr class="fee" style="display:none">
                       <td class="td_right"></td>
                       <td>
                           <span>伙食补助</span>
                           <input type="number" placeholder="自动计算，可修改" name="food_fee"  class="input-text lh25" id="food_fee" size="20">
                           <span></span>
                           <span class="standard">选择目的地，输入天数后,获取报销/补贴标准</span>
                       </td>
                   </tr>
                   <tr class="fee" style="display:none">
                       <td class="td_right">其它报销：</td>
                       <td height="40px" style="line-height:40px" colspan="3">
                           <span>网上追逃费</span>
                           <input type="number" placeholder="网上追逃奖励金"  name="other_reward_fee"  class="input-text lh25" id="other_reward_fee" size="20">
                           <span>嫌疑人费用</span>
                           <input type="number" placeholder="嫌疑人费用报销"  name="other_suspect_fee"  class="input-text lh25" id="other_suspect_fee" size="20">
                       </td>
                   </tr>
                  <tr class="fee" style="display:none">
                      <td class="td_right"></td>
                      <td>
                          <span class="drive_self">车辆维护费</span>
                          <input type="number" placeholder="车辆维护费"  name="car_maintain_fee"  class="input-text lh25 drive_self" id="car_maintain_fee" size="20">
                          <span>其它报销费</span>
                          <input type="number" placeholder="其它无归类的费用"  name="other_other_fee"  class="input-text lh25" id="other_other_fee" size="20">
                      </td>
                  </tr>
                   <!--<tr class="fee" style="display:none">-->
                       <!--<td class="td_right"></td>-->
                       <!--<td>-->
                           <!--<span>其它费用</span>-->
                           <!--<input type="number" placeholder="请输入其它费用，无请填0" value=0 name="other_fee" value="0" class="input-text lh25" id="other_fee" size="20">-->
                       <!--</td>-->
                   <!--</tr>-->
                   <!--<tr class="fee" style="display:none">-->
                       <!--<td class="td_right">公务卡报销：</td>-->
                       <!--<td height="40px">-->
                           <!--<input type="number" placeholder="请填写公务卡报销费用" value=0 name="official_fee" class="input-text lh25" id="official_fee" size="30">-->
                           <!--<span></span>-->
                       <!--</td>-->
                   <!--</tr>-->
                   <tr class="fee" style="display:none">
                       <td class="td_right">总报销费用：</td>
                       <td colspan="4">
                           <input type="number" placeholder="自动计算总费用" name="total_fee" value="" class="input-text lh25" id="total_fee" size="30" disabled>
                             <span style="padding-left: 50%">
                               <button class="btn btn-warning " id="modify_fee" disabled type="button" disabled>修改费用信息</button>
                               <button class="btn btn-danger" id="confirm_fee" type="button">确认费用信息</button>
                           </span>
                       </td>
                   </tr>

               </table>
               </form>
            </div>
          </div>
        </div>
         <div class="box_bottom pb5 pt5 pr10" style="border:1px solid #dadada;display:none" id="add_btn_wrap">
             <div class="search_bar_btn" style="text-align:right;">
                 <input type="button" id="add_list_btn" value="添加" class="ext_btn btn83 ext_btn_submit">
             </div>
         </div>

      <div id="table" class="mt10">
          <div class="box_top"><b class="pl15">报销数据表</b></div>
          <div class="box span10 oh">
              <table width="100%" border="0" cellpadding="0" cellspacing="0" class="list_table" id="info_fee_table">
                  <tr>
                      <th class="td_center" style="width:3%">序号</th>
                      <th class="td_center" style="width:10%">开始日期</th>
                      <th class="td_center" style="width:12%">出发地</th>
                      <th class="td_center" style="width:10%">结束日期</th>
                      <th class="td_center" style="width:12%">目的地</th>
                      <th class="td_center" style="width:5%">车费</th>
                      <th class="td_center" style="width:5%">船费</th>
                      <th class="td_center" style="width:5%">机票</th>
                      <th class="td_center" style="width:6%">天(路/停)</th>
                      <th class="td_center" style="width:6%">住宿费用</th>
                      <th class="td_center" style="width:6%">伙食补助</th>
                      <th class="td_center" style="width:5%">公杂费</th>
                      <th class="td_center" style="width:5%">其它</th>
                      <th class="td_center" style="width:10%">操作</th>
                  </tr>
                  <tr class="fee_row" style="display:none">
                      <td class="td_right" colspan="5"><b>小计</b></td>
                      <td style="text-align:center">0</td>
                      <td style="text-align:center">0</td>
                      <td style="text-align:center">0</td>
                      <td style="text-align:center">0</td>
                      <td style="text-align:center">0</td>
                      <td style="text-align:center">0</td>
                      <td style="text-align:center">0</td>
                      <td style="text-align:center">0</td>
                      <td style="text-align:center"></td>
                  </tr>
                  <!--<tr class="fee_row" style="display:none">-->
                      <!--<td class='td_right' colspan="11"><b>公务卡费用合计：</b></td>-->
                      <!--<td class='td_center' colspan="3"><span id="total_official_fee">0</span></td>-->
                  <!--</tr>-->
                  <tr class="fee_row" style="display:none">
                      <td class='td_right' colspan="11"><b>报销费用合计：</b></td>
                      <td class='td_center' colspan="3"><span id="total_table_fee">0</span></td>
                  </tr>
              </table>
          </div>
      </div>
      <div class="box_bottom pb5 pt5 pr10" style="border:1px solid #dadada;">
          <div class="search_bar_btn" style="text-align:right;">
              <input type="button" name="button" class="btn1 btn82 btn_del disabled" id="clear_btn" value="清空" disabled>
              <input type="button" name="button" class="btn1 btn82 btn_count disabled" id="confirm_btn" value="提交" disabled>
          </div>
      </div>
   </div>
   <!-- 附加审批文件对话框-->
 <div id="fee_append_file_dialog" style="display:none" class="mt10" title="附加审批文件">
     <div class="box">
         <div class="box_center">
             <table class="form_table pb15" id="fee_append_table" width="100%" border="0" cellpadding="0" cellspacing="0">
                 <tr>
                     <td class="td_right">嫌疑人报销单</td>
                     <td>
                                <span class="pl5">
                                    <input type="button" id="suspect_fee_table" name="button" class="btn1 btn82 btn_add" value="填写">
                                </span>
                         <span class="ui-state-error-text"><i class='ui-icon ui-icon-circle-close'></i>未填写</span>
                     </td>
                 </tr>
                 <tr>
                     <td class="td_right">未使用公务卡报销费用审批单</td>
                     <td>
                                <span class="pl5">
                                    <input type="button" id="official_fee_table" name="button" class="btn1 btn82 btn_add" value="填写">
                                </span>
                         <span class="ui-state-error-text"><i class='ui-icon ui-icon-circle-close'></i>未填写</span>
                     </td>
                 </tr>
                 <tr>
                     <td class="td_right">超标交通报销单</td>
                     <td>
                                <span class="pl5">
                                    <input type="button" id="over_fee_table" name="button" class="btn1 btn82 btn_add" value="填写">
                                </span>
                         <span class=""><i class='ui-icon ui-icon-info'></i>选填</span>
                     </td>
                 </tr>
                 <tr>
                     <td class="td_right">自驾车里程附件</td>
                     <td class="" id="upload_area">
                         <form id="upload_file_area" action="Upload" method="post" enctype="multipart/form-data">
                             <input id="upload" type="file" style="display: none" multiple name="files[]" class="input-text lh30" size="10">
                         </form>
                         <a class="ext_btn" id="uploadButton"><span class="upload"></span>上传</a>
                         <input id="filearea" type="text" class="input-text lh25" disabled size="30" placeholder="未上传任何附件，请上传里程照片">
                         <span class="ui-state-error-text"><i class='ui-icon ui-icon-circle-close'></i>未上传</span>
                     </td>
                 </tr>
             </table>
         </div>
     </div>
 </div>
 <!--嫌疑人费用报销单对话框 -->
 <div id="suspect_fee" class="mt10" style="display: none">
     <div class="box">
         <div class="box_border">
             <div class="box_center"></div>
             <table class="form_table pt15 pb15" width="100%" border="0" cellpadding="0" cellspacing="0">
                 <tr>
                     <td class="td_right" valign="top">嫌疑人姓名：</td>
                     <td class="">
                         <textarea name="" id="suspect_name" placeholder="请输入嫌疑人姓名，多人请用逗号分隔" cols="30" rows="10" class="textarea"></textarea>
                     </td>
                 </tr>
                 <tr>
                     <td class="td_right">嫌疑人总费用：</td>
                     <td height="40px" style="line-height:40px">
                         <input type="number" name="pre_suspect_fee" class="input-text lh25" id="pre_suspect_fee" size="20" disabled>
                         <span></span>
                     </td>
                 </tr>
                 <tr>
                     <td class="td_right">生活费：</td>
                     <td>
                         <input type="number" placeholder="嫌疑人生活费" name="suspect_life_fee" value="0" class="input-text lh25" id="suspect_life_fee" size="20">
                         <span></span>
                     </td>
                 </tr>
                 <tr>
                     <td class="td_right">交通费：</td>
                     <td>
                         <input type="number" placeholder="嫌疑人交通费" name="suspect_road_fee" value="0" class="input-text lh25" id="suspect_road_fee" size="20">
                         <span></span>
                     </td>
                 </tr>
                 <tr>
                     <td class="td_right">其它费用：</td>
                     <td>
                         <input type="number" placeholder="嫌疑人其它费用" name="suspect_other_fee" value="0" class="input-text lh25" id="suspect_other_fee" size="20">
                         <span></span>
                     </td>
                 </tr>
                 <tr>
                     <td class="td_right">是否均有票：</td>
                     <td class="">
                         <input type="radio" name="hasReceipe" value="1"> 是
                         <input type="radio" name="hasReceipe" value="0" checked> 否
                     </td>
                 </tr>
                 <tr id="non_rece_area">
                     <td class="td_right" valign="top">无票理由：</td>
                     <td class="">
                         <textarea name="" id="non_rece_reason" placeholder="请描述无票理由" cols="35" rows="20" class="textarea"></textarea>
                     </td>
                 </tr>
             </table>
         </div>
     </div>
 </div>
 <div id="overstandard_app" class="mt10" style="display:none" title="超标交通费用审批单">
     <div class="box">
         <div class="box_center">
             <table class="form_table pb15" width="100%" border="0" cellpadding="0" cellspacing="0">
                 <tr>
                     <td class="td_left">所属部门：</td>
                     <td class="">
                         <input type="text" placeholder="请输入所属部门" class="input-text lh25" size="20" id="over_depart">
                     </td>
                 </tr>
                 <tr>
                     <td class="td_left">申报人：</td>
                     <td class="">
                         <input type="text" placeholder="请输入人员姓名" class="input-text lh25" size="20" id="over_user">
                     </td>
                 </tr>
                 <tr>
                     <td class="td_left">超标原因：</td>
                     <td class="">
                         <textarea name="" id="over_reason" cols="30" rows="10" class="textarea"></textarea>
                     </td>
                 </tr>
             </table>
         </div>
     </div>
 </div>
 <div id="official_fee_dlg" class="mt10" style="display:none" title="强制使用公务卡报销费用填写窗口">
     <table class="form_table pt15 pb15" width="100%" border="0" cellpadding="0" cellspacing="0">
         <tr>
             <td class="td_right">住宿费用：</td>
             <td height="30px" style="line-height:30px">
                 <input type="number" placeholder="请输入住宿费,无请填0" name="official_hotel_fee" value="0" class="input-text lh25 input_fee" id="official_hotel_fee" size="10">
                 <span></span>
             </td>
             <td class="td_right">应报费用：</td>
             <td height="30px" style="line-height:30px">
                 <input type="number" id="max_official_hotel_fee" value="0" class="input-text lh25 pre_fee" size="10" disabled>
             </td>
         </tr>
         <tr>
             <td class="td_right">机票费用：</td>
             <td height="30px" style="line-height:30px">
                 <input type="number" placeholder="请输入机票费用,无请填0" name="official_plane_fee" value="0" class="input-text lh25 input_fee" id="official_plane_fee" size="10">
                 <span></span>
             </td>
             <td class="td_right">应报费用：</td>
             <td height="30px" style="line-height:30px">
                 <input type="number" id="max_official_plane_fee" value="0" class="input-text lh25 pre_fee" size="10" disabled>
             </td>
         </tr>
         <tr>
             <td class="td_right">油费费用：</td>
             <td height="30px" style="line-height:30px">
                 <input type="number" placeholder="请输入油费,无请填0" name="official_oil_fee" value="0" class="input-text lh25 input_fee" id="official_oil_fee" size="10">
                 <span></span>
             </td>
             <td class="td_right">应报费用：</td>
             <td height="30px" style="line-height:30px">
                 <input type="number" id="max_official_oil_fee" value="0" class="input-text lh25 pre_fee" size="10" disabled>
             </td>
         </tr>
         <tr>
             <td class="td_right">车辆维护费：</td>
             <td height="30px" style="line-height:30px">
                 <input type="number" placeholder="请输入车辆维护费,无请填0" name="official_car_maintain_fee" value="0" class="input-text lh25 input_fee" id="official_car_maintain_fee" size="10">
                 <span></span>
             </td>
             <td class="td_right">应报费用：</td>
             <td height="30px" style="line-height:30px">
                 <input type="number" id="max_official_car_maintain_fee" value="0" class="input-text lh25 pre_fee" size="10" disabled>
             </td>
         </tr>
         <tr>
             <td class="td_right">实报总费用：</td>
             <td height="30px" style="line-height:30px">
                 <input type="number" placeholder="自动计算公务卡报销金额" name="official_total_fee" value="0" class="input-text lh25 input_fee" id="official_total_fee" size="10" disabled>
                 <span></span>
             </td>
             <td class="td_right">应报总费用：</td>
             <td height="30px" style="line-height:30px">
                 <input type="number" id="max_official_total_fee" value="0" class="input-text lh25 pre_fee" size="10" disabled>
             </td>
         </tr>
     </table>
 </div>
 <div id="official_unuse_app_dlg" class="mt10" style="display:none" title="未使用公务卡报销审批单">
     <div class="box">
         <div class="box_center">
             <table class="form_table pb15" width="100%" border="0" cellpadding="0" cellspacing="0">
                 <tr>
                     <td class="td_left">所属部门：</td>
                     <td class="">
                         <input type="text" placeholder="请输入所属部门" class="input-text lh25" size="20" id="unuse_off_section" disabled>
                     </td>
                 </tr>
                 <tr>
                     <td class="td_left">申报人：</td>
                     <td class="">
                         <input type="text" placeholder="请输入人员姓名" class="input-text lh25" size="20" id="unuse_off_user" disabled>
                     </td>
                 </tr>
                 <tr>
                     <td class="td_left">应报公务卡金额：</td>
                     <td class="">
                         <input type="text" class="input-text lh25" size="20" id="need_off_fee" disabled>
                     </td>
                 </tr>
                 <tr>
                     <td class="td_left">实报公务卡金额：</td>
                     <td class="">
                         <input type="text" class="input-text lh25" size="20" id="act_off_fee" disabled>
                     </td>
                 </tr>
                 <tr>
                     <td class="td_left">说明原因：</td>
                     <td class="">
                         <textarea name="" id="unuse_off_reason" cols="30" rows="10" class="textarea"></textarea>
                     </td>
                 </tr>
             </table>
        </div>
    </div>
 </div>


 </body>
 <script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
 <script type="text/javascript" src="js/colResizable-1.6.min.js"></script>
 <script type="text/javascript" src="js/jquery-ui.js"></script>
 <script type="text/javascript" src="js/jquery-ui-timepicker-addon.js"></script>
 <script type="text/javascript" src="js/datapicker_cn.js"></script>
 <script type="text/javascript" src="js/common.js"></script>
 <script src="js/city-picker.data.js"></script>
 <script src="js/city-picker.js"></script>
 <script src="js/main.js"></script>
 <script src="js/config.js" type="text/javascript"></script>
 <script src="js/jquery-impromptu.min.js" type="text/javascript"></script>
 <script src="js/download.min.js" type="text/javascript"></script>
 <script src="js/FeeAppendApprove.js" type="text/javascript" charset="utf-8"></script>
 <script src="js/business_approve.js" type="text/javascript"></script>
 <script type="text/javascript">
     //报销数据
     var reimburseData = {'data':[]};
     //数据表索引
     var tableCount = 0;
     //报销标准
     var standard = {'hotel_max': 0, 'road_food': 0, 'road_inci': 0, 'food' : 0, 'inci' : 0, 'oil_count': 0, 'oil_price': 0};
     var feeStandard = {};
     //表示两步状态
     var state = {'addr': false, 'fee':false};

     //点击确定后，判断各种相关数据是否已经输入完毕
     var fee_check = true;

     //辅助状态，表示当前是否在表格修改模式
     var tableModifyState = false;
     var currentModifyID = -1;

     //辅助状态，表示是否自驾
     var self_drive = false;

     //辅助状态，表示当前是否在修改模式
     var is_modify = 0;

     //辅助状态，处理附加审批申请
     var append_approve = {'needSuspect': false, 'isSuspect':false,
         'needUpload':false, 'isUpload':false, 'isOverApp':false,
         'needOfficial' : false, 'isOfficial':false};

     //辅助变量，保存当前报销数据信息
     var curItem = {};



     //辅助函数，如果是修改状态，重新根据传过来的数据初始化表格
     function initTable(feeItem){
        for(var i = 0; i < feeItem.length; i++){
            reimburseData.data[i] = {
                'start_time': feeItem[i].start_time,
                'start_addr': feeItem[i].start_dest,
                'start_county': feeItem[i].start_county,
                'end_time': feeItem[i].end_time,
                'end_addr': feeItem[i].end_dest,
                'end_county':feeItem[i].end_county,
                'stay_days': feeItem[i].stay_days,
                'road_days': feeItem[i].road_days,
                'oil_fee':feeItem[i].oil_fee,
                'pass_fee': feeItem[i].pass_fee,
                'distance': feeItem[i].distance,
                'car_fee' : feeItem[i].car_fee,
                'boat_fee' : feeItem[i].boat_fee,
                'flight_fee' :  feeItem[i].flight_fee,
                'hotel_fee' : feeItem[i].hotel_fee,
                'inci_fee' : feeItem[i].inci_fee,
                'food_fee' : feeItem[i].food_fee,
                'other_fee' : feeItem[i].other_fee, //这里还要修改
                'suspect_fee': feeItem[i].suspect_fee,
                'reward_fee': feeItem[i].reward_fee,
                'official_fee' : feeItem[i].official_fee,
                'total_fee' : feeItem[i].total_fee
            };
            addDataToTable();
            tableCount++;
        }

     }

     //辅助函数，初始化报销表头用户和基本信息
     function initBasicApplyInfo(){

         $('#apply_name').val(curItem.approval_user_name);
         $('#apply_section_name').val(curItem.section_name);
         $('#business_type').val(getBusinessTypeInfo(curItem.type));
         $('#case_no').val(curItem.case_name == "" ? '否' : curItem.case_name);
         $('#pre_apply_days').val(curItem.days);
         $('#apply_card_num').val(curItem.approval_user_card);
         $('#apply_salary_num').val(curItem.approval_userID);
         $('#self_drive').val(curItem.self_drive);
         $('#execu_level').val(getExecuInfo(curItem.executive_level));
         //预借款信息
         if(curItem.is_loan_money){
             $('#pre_loan_money').val(curItem.loan_money.money);
         }
         else{
             $('#pre_loan_money').val(0);
         }
         $('#pre_destination').val(curItem.destination);
         //是否自驾处理
         self_drive = curItem.self_drive;

         //是否启用会议或培训期选择
         if(curItem.type == 3 || curItem.type == 4){
             $(".is_te_meeting").show();
             $('input:radio[name="is_te_meeting"]').attr('disabled', false);
         }
         else{
             $(".is_te_meeting").hide();
             $('input:radio[name="is_te_meeting"]').attr('disabled', true);
         }

         reimburseData.history_fee_ID = window.localStorage.getItem('history_fee_id');
       //  alert(reimburseData.history_fee_ID);
         reimburseData.approval_ID = curItem.approval_ID;

         if(curItem.fee_data){
             initTable(curItem.fee_data);
             append_approve.isOverApp = curItem.is_over_standard;
             append_approve.isSuspect = curItem.is_suspect_fee;
             reimburseData.approve_userID = curItem.approval_userID;
             reimburseData.approve_sectionID = curItem.section_ID;
         }else{
             //处理当前用户信息
             var userInfo = JSON.parse(window.localStorage.getItem('user_info'));
             var curDepart = window.localStorage.getItem('cur_department');
             reimburseData.approve_userID = userInfo.user_id;
             reimburseData.approve_sectionID = userInfo.department_info[curDepart].department_id;

         }
     }


     //辅助函数，处理时间选择
     function processTime(){
         var startDateTextBox = $('#business_start_time');
         var endDateTextBox = $('#business_end_time');
         startDateTextBox.datetimepicker({
             onClose: function(dateText, inst) {
                 if (endDateTextBox.val() != '') {
                     var testStartDate = startDateTextBox.datetimepicker('getDate');
                     var testEndDate = endDateTextBox.datetimepicker('getDate');
                     if (testStartDate > testEndDate)
                         endDateTextBox.datetimepicker('setDate', testStartDate);
                 }
                 else {
                     endDateTextBox.val(dateText);
                     $('#road_days').val(0);
                 }
                // calcTotalDays();
             },
             onSelect: function (selectedDateTime){
                 endDateTextBox.datetimepicker('option', 'minDate', startDateTextBox.datetimepicker('getDate') );
             }
         });
         endDateTextBox.datetimepicker({
             onClose: function(dateText, inst) {
                 if (startDateTextBox.val() != '') {
                     var testStartDate = startDateTextBox.datetimepicker('getDate');
                     var testEndDate = endDateTextBox.datetimepicker('getDate');
                     if (testStartDate > testEndDate)
                         startDateTextBox.datetimepicker('setDate', testEndDate);
                 }
                 else {
                     startDateTextBox.val(dateText);
                     $('#road_days').val(0);
                 }
               //  calcTotalDays();
             },
             onSelect: function (selectedDateTime){
                 startDateTextBox.datetimepicker('option', 'maxDate', endDateTextBox.datetimepicker('getDate') );
             }
         });
     }


     //辅助函数，计算天数
     function calcDays(){
         $('#business_end_time, #business_start_time').on('change', function(){
             var b = new Date($('#business_start_time').val());
             var e = new Date($('#business_end_time').val());
             if(b == 'Invalid Date' || e == 'Invalid Date'){
                 return;
             }
             var d = parseInt((e - b) / 1000 / 60 / 60 / 24) + 1;
             $('#total_days').val(d);
             $('#road_days').val(d);
         })
     }

     //辅助函数，判断停留天数输入是否合法
     function processStayDays(){
         var stay_days = $('#stay_days').val();
         if(stay_days == ""){
             stay_days = 0;
         }

         var t1 = parseInt(stay_days);
         var t2 = parseInt($('#total_days').val());
         if(t1 > t2){
             return false;
         }
         else{
             $('#road_days').val(t2 - t1);
             return true;
         }
     }

     //辅助函数，判断天数输入是否合法
     function checkNumDays(value){
         var re = /^[0-9]+$/;
         return re.test(value);
     }


     //辅助函数，清空报销信息填写数据
     function clearApproveData(clearAll){
         clearAddData();
         clearFeeData();

         enableDisableAreaData(false, false);
         enableDisableFeeData(true);

         state.addr = false;
         state.fee = false;

         tableModifyState = false;

         showOrHideAddButton();

         if(clearAll){
             $(".apply_row").empty();
           //  $("#total_official_fee").text(0);
             $("#total_table_fee").text(0);
             reimburseData = {'data':[]};
             tableCount = 0;
         }
     }
     //辅助函数，清空地址信息
     function clearAddData(){
         $("#business_start_time").val('');
         $("#business_start_time").datetimepicker('option', 'minDate', '');
         $("#business_start_time").datetimepicker('option', 'maxDate', '');
         $("#start_addr").citypicker('reset');
         $("#start_addr_county").val('');
         $("#business_end_time").val('');
         $("#business_end_time").datetimepicker('option', 'minDate', '');
         $("#business_end_time").datetimepicker('option', 'maxDate', '');
         $("#end_addr").citypicker('reset');
         $("#end_addr_county").val('');
         $("#stay_days").val(0);
         $("#road_days").val(0);
         $("#total_days").val('');
         $("#modify_addr").attr('disabled', true);
         $("#confirm_addr").attr('disabled', false);
     }

     //辅助函数，清空费用信息
     function clearFeeData(){
         $("#car_fee").val(0);
         $("#boat_fee").val(0);
         $("#flight_fee").val(0);
         $("#hotel_fee").val(0);
         $("#other_other_fee").val(0);
         $('#other_reward_fee').val(0);
         $('#other_suspect_fee').val(0);
         $('#pass_fee').val(0);
         $('#oil_fee').val(0);
         $('#road_dist').val(0);
         $("#inci_fee").val(0);
         $("#food_fee").val(0);
         $("#official_fee").val(0);
         $('#total_fee').val(0);
         $('#car_maintain_fee').val(0);
         $('.standard').hide();
         $('#modify_fee').attr('disabled', true);
         $('#confirm_fee').attr('disabled', false);
         $('.fee').hide();
     }

     //辅助函数，处理字符串输入数据
     function processInputString(elem){
         var val = $(elem).val();

         if(val == ""){
             if($(elem).attr('id') == 'start_addr' || $(elem).attr('id') == 'end_addr' )
                $(elem).parent().addClass('error');
             else{
                 $(elem).addClass('error');
             }
         }
         else{
             if($(elem).attr('id') == 'start_addr' || $(elem).attr('id') == 'end_addr' )
                 $(elem).parent().removeClass('error');
             else
                 $(elem).removeClass('error');
         }
         return val;
     }



     //辅助函数，禁用或启用所有出差地信息窗格
     function enableDisableAreaData(needDisable, isAddOrModify){

        // $("#start_addr").attr('disabled', needDisable);
         if(needDisable){
             $('#start_addr').citypicker('destroy');
             $('#end_addr').citypicker('destroy');
         }
         $("#business_start_time").attr('disabled', needDisable);
         $("#business_end_time").attr('disabled', needDisable);

         $("#start_addr_county").attr('disabled', needDisable);


         $("#end_addr_county").attr('disabled', needDisable);
         $("#stay_days").attr('disabled', needDisable);
      //   $("#road_days").attr('disabled', needDisable);

         if(!isAddOrModify){
             return;
         }
         var curID;
         //如果是表格修改模式，现在要知道的是哪个表格项在修改
         //否则就是tableCount
         if(tableModifyState){
                 curID = currentModifyID;
         }
         else{
                 curID = tableCount;
         }
         var s = getAddrBySplit(reimburseData.data[curID].start_addr);

         $('#start_addr').citypicker({
                 province: s[0],
                 city: s[1],
                 district: s[2]
             });
         s = getAddrBySplit(reimburseData.data[curID].end_addr);
         $('#end_addr').citypicker({
                 province: s[0],
                 city: s[1],
                 district: s[2]
             });

     }

     //辅助函数，禁用或启用所有费用信息窗格
     function enableDisableFeeData(needDisable){
         $("#car_fee").attr('disabled', needDisable);
         $("#boat_fee").attr('disabled', needDisable);
         $("#flight_fee").attr('disabled', needDisable);
         $("#hotel_fee").attr('disabled', needDisable);
         $("#other_other_fee").attr('disabled', needDisable);
         $("#other_reward_fee").attr('disabled', needDisable);
         $("#other_suspect_fee").attr('disabled', needDisable);
         $("#inci_fee").attr('disabled', needDisable);
         $("#food_fee").attr('disabled', needDisable);
         $("#official_fee").attr('disabled', needDisable);
         $('#pass_fee').attr('disabled', needDisable);
         $('#road_dist').attr('disabled', needDisable);
         $('#car_maintain_fee').attr('disabled', needDisable);

     }

     //辅助函数，处理费用信息填写区域的显示

     //辅助函数，确认出差地信息
     function confirmArea(){
         $('#confirm_addr').click(function(e){
             var v = processAreaData();
             if(v == 1){
                 enableDisableAreaData(true, true);
                 enableDisableFeeData(false);
                 $(this).attr('disabled', true);
                 $('#modify_addr').attr('disabled', false);
                 $('.fee').css('display', '');

                 if(self_drive == '1'){
                     $('.drive_self').show();
                     $('.non_drive_self').hide();
                 }
                 else{
                     $('.drive_self').hide();
                     $('.non_drive_self').show();
                 }

                 state.addr = true;
                 //获取补助信息，显示补助信息
                 getStandard();
                 calcTotalFee();
             }
             else{
                 if(v == -1){
                     $.prompt("<h3>有未填写完整的信息，请根据提示修改？</h3>",{
                         title: '错误提醒',
                         buttons: {'确定': true}
                     });
                 }
                 if(v == -2){
                     $.prompt("<h3>停留天数输入非法，请勿超过总天数？</h3>",{
                         title: '错误提醒',
                         buttons: {'确定': true}
                     });
                 }
             }
             e.preventDefault();
         });

     }

     //辅助函数，修改出差地信息
     function modifyAreaData(){
         $('#modify_addr').click(function(e){
             $.prompt("<h3>修改出差地后，需要重新输入费用信息，确定吗？</h3>",{
                 title: '错误提醒',
                 buttons: {'确定': true, '取消':false},
                 submit: function(e, v, m, f){
                     if(v){
                         $('#modify_addr').attr('disabled', true);
                         $('#confirm_addr').attr('disabled', false);
                         $('.fee').css('display', 'none');
                         state.addr = false;
                         state.fee = false;
                         enableDisableAreaData(false, true);
                         enableDisableFeeData(true);
                         showOrHideAddButton();
                     }
                 }
             });
         })
     }

     //辅助函数，处理出差地信息
     function processAreaData(){
         var start_time = processInputString($('#business_start_time'));
         var start_addr = processInputString($('#start_addr'));
         var start_county = $('#start_addr_county').val();
         if(start_county == ""){
             $('#start_addr_county').val('无');
         }


         var end_time = processInputString($('#business_end_time'));
         var end_addr = processInputString($("#end_addr"));
         var end_county = $('#end_addr_county').val();
         if(end_county == ""){
             $('#end_addr_county').val('无');
         }


         var stay_days = $('#stay_days').val();
         var road_days = $('#road_days').val();

         if(start_time == "" || start_addr == "" || end_time == "" || end_addr == "" || stay_days == "" || !judgeAddr(start_addr) || !judgeAddr(end_addr)){
            return -1;
         }
         else if(!processStayDays()){
             return -2;
         }
         else{
             //记录数据
             var curID = 0;
             if(tableModifyState){
                 curID = currentModifyID;
             }
             else{
                 curID = tableCount;
             }
             reimburseData.data[curID] = {
                 'start_time': start_time,
                 'start_addr': start_addr,
                 'start_county': start_county,
                 'end_time': end_time,
                 'end_addr': end_addr,
                 'end_county':end_county,
                 'stay_days':stay_days,
                 'road_days': road_days
             };


             state.addr = true;
             return 1;
         }
     }

     //辅助函数，确认费用信息
     function confirmFee(){
         $("#confirm_fee").click(function(){
             if(processFeeData()){
                 enableDisableFeeData(true);
                 $(this).attr('disabled', true);
                 $('#modify_fee').attr('disabled', false);
                 state.fee = true;
                 showOrHideAddButton();
             }
         })
     }
     //辅助函数，修改费用信息
     function modifyFee(){
         $('#modify_fee').click(function(){
             enableDisableFeeData(false);
             $(this).attr('disabled', false);
             $('#confirm_fee').attr('disabled', true);
             state.fee = false;
             showOrHideAddButton();
         })
     }


     //辅助函数，处理费用信息
     function processFeeData(){
         var car_fee  = processFee1($('#car_fee'));
         var boat_fee = processFee1($('#boat_fee'));
         var flight_fee = processFee1($('#flight_fee'));
         var oil_fee = $('#oil_fee').val();
      //   var oil_fee = processFee1($('#oil_fee'));
         var pass_fee = processFee1($('#pass_fee'));
         var road_dist = processFee4($('#road_dist'));


         var hotel_fee = processFee2($('#hotel_fee'));
         var inci_fee = processFee2($('#inci_fee'));
         var food_fee = processFee2($('#food_fee'));
         var other_other_fee = processFee1($('#other_other_fee'));
         var other_reward_fee = processFee1($('#other_reward_fee'));
         var other_suspect_fee = processFee1($('#other_suspect_fee'));
         var car_maintain_fee = processFee1($('#car_maintain_fee'));




         if(car_fee == -1 || boat_fee == -1 || flight_fee == -1 || hotel_fee == -1 || inci_fee == -1
             || oil_fee == -1 || pass_fee == -1 || road_dist == -1 || food_fee == -1
             || other_other_fee == -1 || other_reward_fee == -1 || pass_fee == -1
             || other_suspect_fee == -1){
             $.prompt( "<h3>费用信息输入有误，请根据提示修改</h3>",{
                 title: '错误提醒',
                 buttons: {'确定': true},
             });
             return false;
         }


         var total_fee = $('#total_fee').val();
         var curID = 0;
         if(tableModifyState){
             curID = currentModifyID;
         }else{
             curID = tableCount;
         }
         reimburseData.data[curID].car_fee = car_fee;
         reimburseData.data[curID].boat_fee = boat_fee;
         reimburseData.data[curID].flight_fee = flight_fee;
         reimburseData.data[curID].oil_fee = oil_fee;
         reimburseData.data[curID].pass_fee = pass_fee;
         reimburseData.data[curID].distance = road_dist;
         reimburseData.data[curID].hotel_fee = hotel_fee;
         reimburseData.data[curID].inci_fee = inci_fee;
         reimburseData.data[curID].food_fee = food_fee;
         reimburseData.data[curID].other_fee = other_other_fee;
         reimburseData.data[curID].suspect_fee = other_suspect_fee;
         reimburseData.data[curID].reward_fee = other_reward_fee;
         reimburseData.data[curID].car_main_fee = car_maintain_fee;
         reimburseData.data[curID].total_fee = total_fee;

         return true;
     }



     //辅助函数，处理住宿费标准
     function processHotelStandard(){
         var user = JSON.parse(window.localStorage.getItem('user_info'));
         //处理住宿报销显示
         var sStr = '';
         if(user.executive_level >= 7){
             standard.hotel_max = feeStandard.hotel.bureau;
             sStr = '报销标准(厅局级):' + standard.hotel_max + "元/天"
         }
         else{
             standard.hotel_max = feeStandard.hotel.other;
             sStr = '报销标准(其它):' + standard.hotel_max + "元/天";
         }

         if(feeStandard.hotel.is_fire == 1){
             sStr += '(旺季)';
         }
         else{
             sStr += '(淡季)';
         }
         $('#hotel_fee').next().next().html(sStr);
     }

     //辅助函数，处理自驾车标准
     function processSelfDriveStandard(){
         //处理自驾车邮费
         standard.oil_count= feeStandard.oil.count;
         standard.oil_price = feeStandard.oil.price;
         $('#oil_fee').next().html('标准:' + standard.oil_count + "升/百公里," + standard.oil_price + "元/升");
         //处理自驾车邮费结束
     }


     //辅助函数，处理报销标准的获取
     function getStandard(){
         var curID = 0;
         if(tableModifyState){
             curID = currentModifyID;
         }
         else{
             curID = tableCount;
         }

         //停留地的城市ID和省份ID
         var cityID = $('#end_addr').data('citypicker').getCode();
         //获取出发地的城市ID和省份ID
         var beginCityID = $('#start_addr').data('citypicker').getCode();

       //  alert(cityID);
         var cs = cityID.split('/');
         cityID = cs[cs.length-1];
         var provinceID = cs[0];

         cs = beginCityID.split('/');
         beginCityID = cs[cs.length-1];
         var beginProvinceID = cs[0];

         var endTime = reimburseData.data[curID].end_time;

         $('#dataLoad').show();
         $.post(url + 'Common/GetStandard.php', {'city':cityID, 'date':endTime}, function(data){
             $('#dataLoad').hide();
             var t = JSON.parse(data);
             if(t.state == 1){
                 feeStandard = t;

                 //处理住宿报销显示
                 processHotelStandard();
                 //处理自驾车油费标准
                 processSelfDriveStandard();
                 //处理公杂费和吃饭费标准
                 //如果结束地是翠屏区，就使用出发地作为公杂费报销标准
                 if(cityID == '511502'){
                     cityID = beginCityID;
                     provinceID = beginProvinceID;
                 }
                 var footStr = '', subsidyStr = '';
                 //如果在翠屏区，临港区，高县监狱出差
                 if(cityID == '511502' || cityID == '511504' || cityID == '511530'){
                     standard.food = t.food_subsidy.local_food;
                     standard.inci = t.food_subsidy.local_subsidy;
                     footStr = '报销标准(区内):' + standard.food + "元/天；";
                     subsidyStr = '报销标准(区内):' + standard.inci + "元/天；"
                 }
                 //如果是区外省内出差
                 else if(provinceID == '510000'){
                     standard.food = t.food_subsidy.province_food;
                     standard.inci = t.food_subsidy.province_subsidy;
                     footStr = '报销标准(省内):' + standard.food + "元/天；";
                     subsidyStr = '报销标准(省内):' + standard.inci + "元/天；"
                 }else{
                     standard.food = t.food_subsidy.out_food;
                     standard.inci = t.food_subsidy.out_subsidy;
                     footStr = '报销标准(省外):' + standard.food + "元/天；";
                     subsidyStr = '报销标准(省外):' + standard.inci + "元/天；"
                 }

                 //获取停留时间和路上时间
                 var stay_days = parseInt($('#stay_days').val());
                 var road_days = parseInt($('#road_days').val());
                 var total_food_fee = 0, total_inci_fee = 0;
                 //获取当前停留时间是否为会议/培训期
                 var isMeetingOrTrainning = $('input[type="radio"][name="is_te_meeting"]:checked').val();

                 //如果是会议或培训报销，且停留期间为会议或培训
                 if( (curItem.type == '3' || curItem.type == '4') && isMeetingOrTrainning == 1){
                     footStr += ' 会议或培训期: 0元/天';
                     subsidyStr += ' 会议或培训期: ' + standard.inci / 2 + "元/天";
                    total_food_fee = standard.food * road_days;
                    total_inci_fee = standard.inci / 2 * stay_days + standard.inci * road_days;
                 }
                 else{
                     total_food_fee = standard.food * stay_days + standard.food * road_days;
                     total_inci_fee = standard.inci * (stay_days + road_days);
                 }

                 $('#food_fee').next().next().html(footStr);
                 $('#inci_fee').next().next().html(subsidyStr);
                 $('#food_fee').val(total_food_fee);
                 $('#inci_fee').val(total_inci_fee);
                 calcTotalFee();

                 $('.standard').show();
             }
         })
     }


     //辅助函数，显示或隐藏添加按钮
     function showOrHideAddButton(){

         if(state.addr && state.fee){
             $('#add_btn_wrap').css('display', '');
             if(tableModifyState){
                 $('#add_list_btn').val('确认修改');
             }
             else{
                 $('#add_list_btn').val('添加');
             }
         }
         else{
             $('#add_btn_wrap').css('display', 'none');
         }
     }

     //辅助函数，处理清空和生成按钮的启用和禁用
     function setClearAndCreateBtn(enable){
         if(enable){
             $('#clear_btn').attr('disabled', false);
             $('#clear_btn').removeClass('disabled');
             $('#confirm_btn').attr('disabled', false);
             $('#confirm_btn').removeClass('disabled');
         }
         else{
             $('#clear_btn').attr('disabled', true);
             $('#clear_btn').addClass('disabled');
             $('#confirm_btn').attr('disabled', true);
             $('#confirm_btn').addClass('disabled');
         }
     }

     //辅助函数，添加数据到表格的处理或者修改数据的处理
     function addDataToTableButtonClick(){
         $('#add_list_btn').click(function(e){

             addDataToTable();
             setClearAndCreateBtn(true);
             if(tableModifyState){
                 clearApproveData(false);
                 tableModifyState = false;
                 currentModifyID = -1;
                 $.prompt("<h3>数据修改成功</h3>", {
                     title: '操作提醒',
                     buttons: {'确定': true}
                 })
             }
             else{
                 tableCount++;
                 clearApproveData(false);
                 $.prompt("<h3>添加成功</h3>", {
                     title: '操作提醒',
                     buttons: {'确定': true}
                 })
             }


         })
     }

     //辅助函数，统计表格数据
     function getTotalDataInTable(){
         var total_fee = 0, total_official_fee = 0;
         var fee1_1 = 0, fee2_1 = 0, fee3_1 = 0, fee4 = 0, fee5 = 0, fee6 = 0, fee7 = 0, fee8 = 0, fee9 = 0,
             fee1_2 = 0, fee2_2 = 0, fee3_2 = 0;

         for(var i = 0; i < reimburseData.data.length; i++){
             fee1_1 += parseFloat(reimburseData.data[i].car_fee);
             fee2_1 += parseFloat(reimburseData.data[i].boat_fee);
             fee3_1 += parseFloat(reimburseData.data[i].flight_fee);
             fee1_2 += parseFloat(reimburseData.data[i].oil_fee);
             fee2_2 += parseFloat(reimburseData.data[i].pass_fee);
             fee3_2 += parseFloat(reimburseData.data[i].distance);
             fee4 += parseFloat(reimburseData.data[i].stay_days);
             fee5 += parseFloat(reimburseData.data[i].road_days);
             fee6 += parseFloat(reimburseData.data[i].hotel_fee);
             fee7 += parseFloat(reimburseData.data[i].food_fee);
             fee8 += parseFloat(reimburseData.data[i].inci_fee);
             fee9 +=  parseFloat(reimburseData.data[i].other_fee) + parseFloat(reimburseData.data[i].suspect_fee)
                     + parseFloat(reimburseData.data[i].reward_fee) + parseFloat(reimburseData.data[i].car_main_fee);
             total_fee += parseFloat(reimburseData.data[i].total_fee);
             total_official_fee += parseFloat(reimburseData.data[i].official_fee);
         }

         $('#total_official_fee').text(total_official_fee);
         $('#total_table_fee').text(total_fee);
         var tds = $('.fee_row').eq(0).find('td');
         if(self_drive == 0){
             $(tds[1]).text(fee1_1);
             $(tds[2]).text(fee2_1);
             $(tds[3]).text(fee3_1);
         }
         else{
             $(tds[1]).text(fee1_2);
             $(tds[2]).text(fee2_2);
             $(tds[3]).text(fee3_2);
         }

         $(tds[4]).text(fee4 + "/" + fee5);
         $(tds[5]).text(fee6);
         $(tds[6]).text(fee7);
         $(tds[7]).text(fee8);
         $(tds[8]).text(fee9);

     }

     //辅助函数，添加数据到表格
     function addDataToTable(){
         //定义一个当前ID
         var curID = 0;
         //如果是修改，则等于修改的ID
         if(tableModifyState){
             curID = currentModifyID;
         }
         //否则是添加，等于当前表格计数器
         else{
             curID = tableCount;
         }

         var tempStartAddr;
         var tempEndAddr;
         var startCounty = reimburseData.data[curID].start_county;
         if(startCounty != ""){
             tempStartAddr = reimburseData.data[curID].start_addr + "/" + startCounty;
         }else{
             tempStartAddr = reimburseData.data[curID].start_addr;
         }
         var endCounty = reimburseData.data[curID].end_county;
         if(endCounty != ""){
             tempEndAddr = reimburseData.data[curID].end_addr + "/" + endCounty;
         }
         else{
             tempEndAddr = reimburseData.data[curID].end_addr;
         }
        //计算总计数据
         getTotalDataInTable();
         var other_total_fee = parseFloat(reimburseData.data[curID].other_fee) + parseFloat(reimburseData.data[curID].suspect_fee)
                 + parseFloat(reimburseData.data[curID].reward_fee) + parseFloat(reimburseData.data[curID].car_main_fee);
         var appendData = "<tr class='apply_row'>" +
                 "<td class='td_center'>" + (curID+1) +"</td>" +
                 "<td class='td_center'>" + reimburseData.data[curID].start_time + "</td>" +
                 "<td class='td_center'>" + tempStartAddr + "</td>" +
                 "<td class='td_center'>" + reimburseData.data[curID].end_time + "</td>" +
                 "<td class='td_center'>" + tempEndAddr + "</td>" +
                 "<td class='td_center'>" + (self_drive == 0 ? reimburseData.data[curID].car_fee : reimburseData.data[curID].oil_fee) + "</td>" +
                 "<td class='td_center'>" + (self_drive == 0 ? reimburseData.data[curID].boat_fee : reimburseData.data[curID].pass_fee) +"</td>" +
                 "<td class='td_center'>" + (self_drive == 0 ? reimburseData.data[curID].flight_fee : reimburseData.data[curID].distance) + "</td>" +
                 "<td class='td_center'>" + reimburseData.data[curID].stay_days + "/" + reimburseData.data[curID].road_days + "</td>" +
                 "<td class='td_center'>" + reimburseData.data[curID].hotel_fee + "</td>" +
                 "<td class='td_center'>" + reimburseData.data[curID].food_fee + "</td>" +
                 "<td class='td_center'>" + reimburseData.data[curID].inci_fee + "</td>" +
                 "<td class='td_center'>" + other_total_fee + "</td>" +
                 "<td class='td_center'><a href='' class='ext_btn modify_btn'><span class='modify'></span>修改</a></td></td>" +
                 "</tr>";
         if(tableModifyState){
             var tds = $('.apply_row').eq(curID).find('td');
             $(tds[0]).html(curID + 1);
             $(tds[1]).html(reimburseData.data[curID].start_time);
             $(tds[2]).html(tempStartAddr);
             $(tds[3]).html(reimburseData.data[curID].end_time);
             $(tds[4]).html(tempEndAddr);
             $(tds[5]).html(self_drive == 0 ? reimburseData.data[curID].car_fee : reimburseData.data[curID].oil_fee);
             $(tds[6]).html(self_drive == 0 ? reimburseData.data[curID].boat_fee : reimburseData.data[curID].pass_fee);
             $(tds[7]).html(self_drive == 0 ? reimburseData.data[curID].flight_fee : reimburseData.data[curID].distance);
             $(tds[8]).html(reimburseData.data[curID].stay_days + "/" + reimburseData.data[curID].road_days);
             $(tds[9]).html(reimburseData.data[curID].hotel_fee);
             $(tds[10]).html(reimburseData.data[curID].food_fee);
             $(tds[11]).html(reimburseData.data[curID].inci_fee);
             $(tds[12]).html(other_total_fee);

         }else{
             $('.fee_row').first().before(appendData);
             //一开始隐藏合计行，有数据再显示
             if($('.fee_row').is(':hidden')){
                 $('.fee_row').show();
             }

             $('.modify_btn').last().click(function(e){
                 e.preventDefault();
                 tableModifyState = true;

                 currentModifyID = curID;
                 modifyData();
             })
         }


     }


     //辅助函数，修改表中的某项数据时，重新在对应区域显示数据
     function modifyData(){
         state.addr = true;
         state.fee = false;
         $("#business_start_time").val(reimburseData.data[currentModifyID].start_time);
         $("#business_end_time").val(reimburseData.data[currentModifyID].end_time);

         var start_addr = getAddrBySplit(reimburseData.data[currentModifyID].start_addr);

         $('#start_addr').citypicker('destroy');
         $("#start_addr").citypicker({
             province: start_addr.province,
             city: start_addr.city,
             district: start_addr.county
         });

         $("#start_addr_county").val(reimburseData.data[currentModifyID].start_county);
         var end_addr = getAddrBySplit(reimburseData.data[currentModifyID].end_addr);

         $('#end_addr').citypicker('destroy');
         $("#end_addr").citypicker({
             province: end_addr.province,
             city: end_addr.city,
             district: end_addr.county
         });

         $("#stay_days").val(reimburseData.data[currentModifyID].stay_days);
         $("#road_days").val(reimburseData.data[currentModifyID].road_days);
     //    $("#total_days").val(reimburseData.data[currentModifyID].total_days);
         $("#modify_addr").attr('disabled', false);
         $("#confirm_addr").attr('disabled', true);
         enableDisableAreaData(true, false);

         getStandard();
         if(self_drive == '0'){
             $("#car_fee").val(reimburseData.data[currentModifyID].car_fee);
             $("#boat_fee").val(reimburseData.data[currentModifyID].boat_fee);
             $("#flight_fee").val(reimburseData.data[currentModifyID].flight_fee);
         }
         else{
             $("#oil_fee").val(reimburseData.data[currentModifyID].oil_fee);
             $("#pass_fee").val(reimburseData.data[currentModifyID].pass_fee);
             $("#road_dist").val(reimburseData.data[currentModifyID].distance);
         }

         $("#hotel_fee").val(reimburseData.data[currentModifyID].hotel_fee);
         $("#other_other_fee").val(reimburseData.data[currentModifyID].other_fee);
         $("#other_reward_fee").val(reimburseData.data[currentModifyID].reward_fee);
         $("#other_suspect_fee").val(reimburseData.data[currentModifyID].suspect_fee);
         $("#inci_fee").val(reimburseData.data[currentModifyID].inci_fee);
         $("#food_fee").val(reimburseData.data[currentModifyID].food_fee);
         $("#official_fee").val(reimburseData.data[currentModifyID].official_fee);
         $('#total_fee').val(reimburseData.data[currentModifyID].total_fee);

         $('#modify_fee').attr('disabled', true);
         $('#confirm_fee').attr('disabled', false);
         $('.fee').show();
         if(self_drive == 1){
             $('.non_drive_self').hide();
         }else{
             $('.drive_self').hide();
         }

         enableDisableFeeData(false);
         showOrHideAddButton();

     }

     //辅助函数，处理上传文件的显示
     function showUploadFile(){
         $('#upload').change(function(){
             var fileStr= $(this).val();
             if(fileStr == ''){
                 $('#filearea').val('');
                 append_approve.isUpload = false;
             }
             var files = fileStr.split(',');
             if(files.length > 3){
                 $.prompt( "<h3>请最多上传三个文件</h3>",{
                     title: '错误提醒',
                     buttons: {'确定': true}
                 });
                 append_approve.isUpload = false;
             }
             var tempStr = '';
             var isOk = true;
             for(var i = 0; i < files.length; i++){
                 var filename = files[i].substring(files[i].lastIndexOf('\\') + 1);
                 var fileExt = files[i].substring(files[i].lastIndexOf('.') + 1);
                 fileExt = fileExt.toLowerCase();
                 if(fileExt == 'jpg' || fileExt == 'png' || fileExt == 'bmp' || fileExt == 'jpeg') {
                     tempStr += filename + ";";
                 }
                 else{
                     $.prompt( "<h3>仅支持图片格式文件上传</h3>",{
                         title: '错误提醒',
                         buttons: {'确定': true}
                     });
                     isOk = false;
                     break;
                 }
             }
             if(isOk){
                 $('#filearea').val(tempStr);
                 $('#filearea').next().removeClass('ui-state-error-text').
                         html("<i class='ui-icon ui-icon-circle-check'></i>已上传");
                 append_approve.isUpload = true;
             }else{
                 append_approve.isUpload = false;
             }
         })
     }

     //辅助函数，处理未使用公务卡审批单的基本信息显示
     function initUnUseOfficialFeeAppDlg(){
         $('#unuse_off_user').val(curItem.approval_user_name);
         $('#unuse_off_section').val(curItem.section_name);
         $('#need_off_fee').val(reimburseData.official_fee_info.max_official_fee);
         $('#act_off_fee').val(reimburseData.official_fee_info.official_total_fee);
     }

     //辅助函数，获取未使用公务卡审批单的信息
     function getUnUseOfficialFeeData(){
         var reason = $('#unuse_off_reason').val();
         if(reason.length == 0){
             $('#unuse_off_reason').addClass('error');
             return false;
         }
         reimburseData.official_fee_info.un_official_reason = reason;
         return true;
     }

     //辅助函数，处理未使用公务卡审批单的显示
     function processUnUseOfficialFeeAppDlg(){
         initUnUseOfficialFeeAppDlg();
         $('#official_fee_table').click(function(){
             $('#official_unuse_app_dlg').dialog({
                 resizable: false,
                 height: "auto",
                 width: "auto",
                 modal: true,
                 buttons: {
                     '确定' :function(){
                         if(!getUnUseOfficialFeeData()){
                             $.prompt("<h3>数据填写错误，请按照提示修改</h3>", {
                                 title: '错误提醒',
                                 buttons: {'确定': true},
                             });
                             append_approve.isOfficial = false;
                         }
                         else{
                             $(this).dialog("close");
                             $('#official_fee_table').parent().next().removeClass('ui-state-error-text')
                                 .html("<i class='ui-icon ui-icon-circle-check'></i>已填写");
                             append_approve.isOfficial = true;
                         }
                     },
                     '取消': function(){
                         $(this).dialog("close");
                     }
                 }
             });
         });

     }

     //辅助函数，处理费用附件对话框的显示
     function initFeeAppendDlg(){
         if(self_drive == '0'){
             //隐藏上传文件对话框
             $('#fee_append_table tr').eq(3).hide();
         }else{
             append_approve.needUpload = true;
             processUploadFile();
             showUploadFile();
         }

         var total_suspect_fee = 0;
         for(var i = 0; i < reimburseData.data.length; i++){
            total_suspect_fee += parseFloat(reimburseData.data[i].suspect_fee);
         }

         if(total_suspect_fee <= 0){
             //隐藏嫌疑人费用报销单
             $('#fee_append_table tr').eq(0).hide();
         }else{
             $('#fee_append_table tr').eq(0).show();
             $('#pre_suspect_fee').val(total_suspect_fee);
             append_approve.needSuspect = true;
             processSuspectFeeDlg();
         }

         //处理公务卡费用报销单的必填项
         if(append_approve.needOfficial){
             $('#fee_append_table tr').eq(1).show();
             processUnUseOfficialFeeAppDlg();
         }
         else{
             $('#fee_append_table tr').eq(1).hide();
         }

     }

     //辅助函数，初始化超标费用审批填写对话框
     function initOverStandardDlg(){
         $('#over_user').val(curItem.approval_user_name);
         $('#over_depart').val(curItem.section_name);
     }

     //辅助函数，处理超标费用审批填写的信息
     function getOverStandardInfo(){
         $('#over_user').val(curItem.approval_user_name);
         $('#over_depart').val(curItem.section_name);

         var reason = $('#over_reason').val();
         if(reason.length == 0){
             $('#over_reason').addClass('error');
             return false;
         }
         else{
             $('#over_reason').removeClass('error');
         }

         reimburseData.overStandard = {
             'over_depart' : $('#over_depart').val(),
             'over_user' : $('#over_user').val(),
             'over_reason' : reason
         };

         return true;
     }

     //辅助函数，处理超标费用审批对话框
     function processOverStandardAppDlg(){
         initOverStandardDlg();
         $('#over_fee_table').click(function(){
             $('#overstandard_app').dialog({
                 resizable: false,
                 height: "auto",
                 width: 600,
                 modal: true,
                 buttons: {
                     '确定' :function(){
                         if(!getOverStandardInfo()){
                             $.prompt("<h3>数据填写错误，请按照提示修改</h3>", {
                                 title: '错误提醒',
                                 buttons: {'确定': true},
                             });
                             append_approve.isOverApp = false;
                         }
                         else{
                             $(this).dialog("close");
                             $('#over_fee_table').parent().next().removeClass('ui-state-error-text')
                                     .html("<i class='ui-icon ui-icon-circle-check'></i>已填写");
                             append_approve.isOverApp = true;
                         }

                     },
                     '取消': function(){
                         $(this).dialog("close");
                     }
                 }
             })
         })
     }
     //辅助函数，处理嫌疑人报销单数据
     function getSuspectFeeData(){
         var suspector = $('#suspect_name').val();
         if(suspector.length == 0){
             $('#suspect_name').addClass('error');
             return false;
         }
         else{
             $('#suspect_name').removeClass('error');
             suspector.replace('，', ',');
         }
         if(!processSuspectTotalFee()){
             return false;
         }
         var hasReceipe = $('input[name="hasReceipe"]:checked').val();
         if(hasReceipe == 0){
             if($('#non_rece_reason').val().length == 0){
                 $('#non_rece_reason').addClass('error');
                 return false;
             }
             else{
                 $('#non_rece_reason').removeClass('error');
             }
         }
         reimburseData.suspect_fee_data = {
             'suspect_name': suspector,
             'suspect_life_fee': $('#suspect_life_fee').val(),
             'suspect_road_fee': $('#suspect_road_fee').val(),
             'suspect_other_fee':$('#suspect_other_fee').val(),
             'has_receipe':hasReceipe,
             'no_receipe_reason': hasReceipe == '1' ? '' : $('#non_rece_reason').val()
         }
         return true;
     }

     //辅助函数，处理嫌疑人报销单填写
     function processSuspectFeeDlg(){
         processSuspectTotalFee();
         processSuspectFeeInput();
         processHasReceipe();


         $('#suspect_fee_table').click(function(){
             $('#suspect_fee').dialog({
                 resizable: false,
                 height: "auto",
                 width: 600,
                 modal: true,
                 title:'嫌疑人费用报销单',
                 buttons: {
                     '确定' :function(){
                         if(!getSuspectFeeData()){
                             append_approve.isSuspect = false;
                             $.prompt("<h3>数据填写错误，请按照提示修改</h3>", {
                                 title: '错误提醒',
                                 buttons: {'确定': true},
                             });
                         }
                         else{
                             append_approve.isSuspect = true;
                             $(this).dialog("close");
                             $('#suspect_fee_table').parent().next().removeClass('ui-state-error-text')
                                     .html("<i class='ui-icon ui-icon-circle-check'></i>已填写")
                         }

                     },
                     '取消': function(){
                         $(this).dialog("close");
                     }
                 }
             })
         })

     }

     //辅助函数，处理时间的判断
     function processTotalDays(){
         var preDays =  parseInt($('#pre_apply_days').val());

         var totalDays = 0;
         for(var i = 0; i < reimburseData.data.length; i++){
                totalDays += parseInt(reimburseData.data[i].total_days);
         }
         if(totalDays > preDays){
             return false;
         }
         return true;
     }

     //辅助函数，上传报销费用信息
     function uploadFeeApprove(){
         console.log(JSON.stringify(reimburseData));
         $('#dataLoad').show();
         $.post(url+'BusinessFee/CreateBusinessFeeApply.php', reimburseData, function(data){
             var files = $('#upload').val();
             $('#dataLoad').hide();
             var t = JSON.parse(data);
            // alert(data);

             if(files == '') {
                 $('#dataLoad').hide();
                 if (t.state == 1) {
                     $.prompt("<h3>提交成功，您可在我的报销中查看审批状态和打印报销单</h3>", {
                         title: '操作提醒',
                         buttons: {'确定': true},
                         submit: function (e, v, m, f) {
                             if(v){
                                 jumpPage('my_fee_apply.html');
                             }

                         }
                     })
                 }
                 else {
                     $.prompt("<h3>网络或数据库错误，请稍后再试</h3>", {
                         title: '错误提醒',
                         buttons: {'确定': true},
                         submit: function (e, v, m, f) {
                             jumpPage('guide.html');
                         }
                     })
                 }
             }
             else{
                 if(t.state == 1) {
                     uploadFile(t, 2);
                 }
                 else{
                     $.prompt("<h3>生成失败，请稍后再试</h3>", {
                         title: '错误提醒',
                         buttons: {'确定': true},
                         submit: function (e, v, m, f) {
                             jumpPage('guide.html');
                         }
                     })
                 }
             }
         });
     }

     //辅助函数，处理公务卡费用信息的输入
     function processOfficialFee(){
         var t = true;
         $('.input_fee').each(function(){
             if($(this).next().hasClass('ui-state-error-text')){
                 t = false;
             }
         });
         if(!t)
             return false;
         reimburseData.official_fee_info = {
             'official_hotel_fee': $('#official_hotel_fee').val(),
             'official_oil_fee' : $('#official_oil_fee').val(),
             'official_car_maintain_fee' : $('#official_car_maintain_fee').val(),
             'official_plane_fee' : $('#official_plane_fee').val(),
             'official_total_fee' : $('#official_total_fee').val(),
             'max_official_hotel_fee' : $('#max_official_hotel_fee').val(),
             'max_official_oil_fee' : $('#max_official_oil_fee').val(),
             'max_official_car_maintain_fee' : $('#max_official_car_maintain_fee').val(),
             'max_official_plane_fee' : $('#max_official_plane_fee').val(),
             'max_official_fee' : $('#max_official_total_fee').val()
         };
         if(parseFloat(reimburseData.official_fee_info.max_official_fee) >
             parseFloat(reimburseData.official_fee_info.official_total_fee)){
             append_approve.needOfficial = true;
             append_approve.isOfficial = false;
             reimburseData.official_fee_info.is_need_unofficial = 1;
         }
         else{
             append_approve.needOfficial = false;
             append_approve.isOfficial = true;
             reimburseData.official_fee_info.is_need_unofficial = 0;
         }
         return true;

     }

     //辅助函数，处理公务卡报销信息的输入和逻辑判断
     function processOfficialFeeDlg(){
         $('#official_fee_dlg').dialog({
             resizable: false,
             height: "auto",
             width: "auto",
             modal: true,
             buttons: {
                 '确定': function(){
                     var r = processOfficialFee();
                     if(!r){
                         $.prompt("<h4>数据填写错误</h4>", {
                             title: '错误提醒',
                             buttons: {'确定': true}
                         });
                     }
                     else{
                         $(this).dialog("close");
                         //处理费用附加报销单或审批单对话框的显示
                         initFeeAppendDlg();
                         processOverStandardAppDlg();
                         $('#fee_append_file_dialog').dialog({
                             resizable: false,
                             height: "auto",
                             width: 600,
                             modal: true,
                             buttons: {
                                 '确定' :function(){
                                     if(((!append_approve.isSuspect) && (append_approve.needSuspect)) ||
                                         ((!append_approve.isUpload) && (append_approve.needUpload)) ||
                                         ((!append_approve.isOfficial) && (append_approve.needOfficial))){
                                         $.prompt("<h5>必要的附加报销信息未填写，请根据提示填写完整</h5>", {
                                             title: '错误提醒',
                                             buttons: {'确定': true}
                                         });
                                     }
                                     else if (!processTotalDays()){
                                         $.prompt("<h4>当前报销总天数超过预批出差天数，请核对并修改</h4>", {
                                             title: '错误提醒',
                                             buttons: {'确定': true}
                                         });
                                     }
                                     else {
                                         uploadFeeApprove();
                                         $(this).dialog("close");
                                     }
                                 },
                                 '取消': function(){
                                     $(this).dialog("close");
                                 }
                             }
                         });
                     }
                 },
                 '取消' :function(){
                     $(this).dialog("close");
                 }
             }
         })
     }


     //辅助函数，处理公务卡报销信息对话框的基本数据显示
     function initOfficialFeeInfoAndDlg(){
         var pre_hotel_fee = 0;
         var pre_oil_fee = 0;
         var pre_plane_fee = 0;
         var pre_maintain_fee = 0;
         console.log(JSON.stringify(reimburseData));
         for(var i = 0; i < reimburseData.data.length; i++){
             pre_hotel_fee += parseFloat(reimburseData.data[i].hotel_fee);
             pre_oil_fee += parseFloat(reimburseData.data[i].oil_fee);
             pre_plane_fee += parseFloat(reimburseData.data[i].flight_fee);
             pre_maintain_fee += parseFloat(reimburseData.data[i].car_main_fee);
         }
         var t = pre_hotel_fee + pre_maintain_fee + pre_oil_fee + pre_plane_fee;
         $('#max_official_total_fee').val(t.toFixed(2));

         $('#max_official_hotel_fee').val(pre_hotel_fee.toFixed(2));
         if(pre_hotel_fee == 0){
             $('#official_hotel_fee').attr('disabled', true);
         }
         else{
             $('#official_hotel_fee').attr('disabled', false);
         }
         $('#max_official_oil_fee').val(pre_oil_fee.toFixed(2));
         if(pre_oil_fee == 0){
             $('#official_oil_fee').attr('disabled', true);
         }
         else{
             $('#official_oil_fee').attr('disabled', false);
         }
         $('#max_official_plane_fee').val(pre_plane_fee.toFixed(2));
         if(pre_plane_fee == 0){
             $('#official_plane_fee').attr('disabled', true);
         }
         else{
             $('#official_plane_fee').attr('disabled', false);
         }
         $('#max_official_car_maintain_fee').val(pre_maintain_fee.toFixed(2));
         if(pre_maintain_fee == 0){
             $('#official_car_maintain_fee').attr('disabled', true);
         }
         else{
             $('#official_car_maintain_fee').attr('disabled', false);
         }
     }


     $(function(){
         curItem = JSON.parse(window.localStorage.getItem('cur_travel_info'));
         $('#start_addr').citypicker();
         $('#end_addr').citypicker();

         initBasicApplyInfo();
         initTableHeader();


         //设置时间选择器
         setDataPicker();
         processTime();
         confirmArea();
         modifyAreaData();
         confirmFee();
         calcDays();
         addDataToTableButtonClick();
         //处理出差天数输入合法非法的逻辑
         $("#stay_days").bind('input propertychange',function(){
             if($(this).next('span').hasClass('state'))
                $(this).next().remove();

             if($(this).val() < 0 || !checkNumDays($(this).val()) || !processStayDays()){
                 $(this).after("<span class='state ui-state-error-text'>" +
                         "<i class='ui-icon ui-icon-circle-close'></i>" +
                         "</span>");
             }
             else{
                 $(this).after("<span class='state'>" +
                         "<i class='ui-icon ui-icon-circle-check'></i>" +
                         "</span>");
             }
         });
         //处理车费，船费，飞机费用，其它费用项输入合法非法的逻辑
         $("#car_fee, #boat_fee, #flight_fee, #other_other_fee, #other_reward_fee, #other_suspect_fee, #pass_fee, #car_maintain_fee")
                 .bind('input propertychange',function(){
             processFee1(this);
             calcTotalFee();
           //  processFee3($('#official_fee'));

         });
         //处理住宿费，餐补，杂费的输入合法逻辑
         $("#hotel_fee, #food_fee, #inci_fee").bind('input propertychange',function(){
             processFee2(this);
             calcTotalFee();
           //  processFee3($('#official_fee'));
         });
//         //处理公务卡费用输入的合法逻辑
//         $("#official_fee").bind('input propertychange', function(){
//             processFee3(this);
//         });

         //处理里程数输入的逻辑
         $('#road_dist').bind('input propertychange', function(){
             processFee4(this);
             calcTotalFee();
            // processFee3($('#official_fee'));
         });

         $('#official_hotel_fee, #official_oil_fee, #official_plane_fee, #official_car_maintain_fee')
             .bind('input propertychange', function(){
                processOfficialFeeInput(this);
                calcTotalOfficialFee();
             });


         $(".list_table").colResizable({
             liveDrag:true,
             gripInnerHtml:"<div class='grip'></div>",
             draggingClass:"dragging",
             resizeMode:'flex'
         });


         $("#clear_btn").click(function(e){
             clearApproveData(true);
             setClearAndCreateBtn(false);
             e.preventDefault();
         });

         $('#confirm_btn').click(function(e){
             //处理公务卡费用报销显示
             initOfficialFeeInfoAndDlg();
             //处理完公务卡费用后，处理其它相关操作，均在这个函数中处理
             processOfficialFeeDlg();
         });


     });
 </script>

 </html>
  